package ch04.game;

/**
 * @author chenmin
 * @desc TODO
 * @date 2025/9/3
 */
/**
 * 装备类
 */
public class Equip {
    private String name;
    private int level;
    private String color;
    private String kind;
    private int power;
    private int defence;

    // 构造方法（初始化装备属性，添加校验）
    public Equip(String name, int level, String color, String kind, int power, int defence) {
        this.name = name;
        this.level = Math.max(1, level);
        this.color = color;
        this.kind = kind;
        this.power = Math.max(0, power);
        this.defence = Math.max(0, defence);
    }

    // Getter（装备属性只读，避免外部篡改）
    public String getName() {
        return name;
    }

    public int getPower() {
        return power;
    }

    public int getDefence() {
        return defence;
    }
}
